﻿using System.Web.Mvc;
using System.Web.Routing;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Example1.Tests
{
    [TestClass]
    public class RouteTests1
    {
        private static RouteCollection _routes;

        [ClassInitialize]
        public static void Setup(TestContext testContext)
        {
           _routes = new RouteCollection();
           var myRoute = new Route("{controller}/{action}", new MvcRouteHandler());
           _routes.Add("Myroute", myRoute);
        }

     

        [TestMethod]
        public void TestMethod1()
        {
            //"~/" -> root
            RouteTestHelper.TestRouteMatch(_routes, "~/Admin/index", "Admin", "index");
            RouteTestHelper.TestRouteMatch(_routes, "~/Customer/Add", "Customer", "add");
            RouteTestHelper.TestRouteFail(_routes, "~/");
            RouteTestHelper.TestRouteFail(_routes, "~/Admin");
            RouteTestHelper.TestRouteFail(_routes, "~/Admin/index/1");
        }
    }
}
